package Scuttlebutt;

import java.lang.*;
import javax.swing.JOptionPane;

public class FTPConnectThread implements Runnable//extends Thread 
{
	Scuttlebutt parent = null;
	
	public FTPConnectThread(Scuttlebutt parent)
	{
		this.parent = parent;
	}

	public void run()
	{
        try
        {
            parent.getFTP().ftpConnect(parent.getProject().getFTPaddress(), parent.getProject().getUsername(), parent.getProject().getPassword());
            
        }catch(Exception e){
	        String msg = new String("failed to connect:" + e);
 		   	JOptionPane.showMessageDialog(null, msg, "Error", JOptionPane.ERROR_MESSAGE);
           System.err.println(msg);
        }
        try
        {
     	   parent.setRemoteHomeDirectory(parent.getFTP().getDirectory());
        }catch(Exception e){
            System.err.println("failed to get directory:" + e);
        }
        parent.setTitle();
	}
}

